package com.sugar.follow.up.module.business.controller.app.feedback;

import com.sugar.follow.up.framework.common.pojo.CommonResult;
import com.sugar.follow.up.framework.security.core.util.SecurityFrameworkUtils;
import com.sugar.follow.up.module.business.controller.app.feedback.vo.FeedbackSaveReqVO;
import com.sugar.follow.up.module.business.service.feedback.FeedbackService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import javax.validation.Valid;

import static com.sugar.follow.up.framework.common.pojo.CommonResult.successApp;

@Tag(name = "APP - 意见反馈")
@RestController
@RequestMapping("/biz/feedback")
@Validated
public class AppFeedbackController {

    @Resource
    private FeedbackService feedbackService;

    @PostMapping("/create")
    @Operation(summary = "创建意见反馈")
    public CommonResult<Long> createFeedback(@Valid @RequestBody FeedbackSaveReqVO createReqVO) {
        return successApp(feedbackService.createFeedback(createReqVO, SecurityFrameworkUtils.getLoginUserId()));
    }
}